package com.hnyfkj.jyindustry.biz.weather.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hnyfkj.jyindustry.biz.weather.dao.WeatherReportListDao;
import com.hnyfkj.jyindustry.biz.weather.dto.WeatherReportListDto;
import com.hnyfkj.jyindustry.biz.weather.dto.WeatherReportListReturnDto;
import com.hnyfkj.jyindustry.biz.weather.entity.WeatherReportList;
import com.hnyfkj.jyindustry.biz.weather.service.WeatherReportListService;
import com.hnyfkj.jyindustry.common.dto.PageReturnDto;
import com.hnyfkj.jyindustry.common.dto.RespDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.Function;

/**
 * @author zhujq
 * @ClassName: AreaDao
 * @Description: 地区信息
 * @date 2021年3月6日 下午12:58:51
 */
@Service
public class WeatherReportListServiceImpl extends ServiceImpl<WeatherReportListDao, WeatherReportList> implements WeatherReportListService {

    @Autowired
    private WeatherReportListDao weatherReportListDao;


    @Override
    public PageReturnDto<WeatherReportList> selectListDto(WeatherReportListDto weatherReportListDto) {
        PageInfo<WeatherReportList> pageInfo = PageHelper.startPage(weatherReportListDto.getPage(), weatherReportListDto.getLimit()).doSelectPageInfo(() -> weatherReportListDao.selectListDto(weatherReportListDto));
        return PageReturnDto.pageOf(pageInfo);
    }

    @Override
    public RespDto<String> deleteByIds(String id) {
        String[] split = id.split(",");
        weatherReportListDao.deleteBatchIds(Arrays.asList(split));
        return RespDto.succ();
    }
}
